package chapter05;

public class java04_Object {
    public static void main(String[] args) {
        // TODO 常见类和对象
        // 二维数组
        int row = 9;
        int col = 2 * (row - 1) + 1;
        String[][] ta = new String[row][col];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col ; j++){
                if ( j < (col - ( 2 * i + 1)) / 2 ) {
                    ta[i][j] = " ";
                } else if ( j >= (col - ( 2 * i + 1)) / 2  && j < (col - ( 2 * i + 1)) / 2 + 2 * i + 1) {
                    ta[i][j] = "*";
                } else {
                    ta[i][j] = " ";
                }
            }
        }

        for ( int i = 0; i < row; i++) {
            for ( int j = 0; j < col; j++) {
                System.out.print(ta[i][j]);
            }
            System.out.println(" ");
        }
    }
}
